<div id="registrationfromsuccess" style="border: 2px solid black;color: black;
     padding: 25px 15px 21px 18px;display: none;
     float: left;
     min-height: 350px;
     max-width: 370px;"></div>
<div id="usersregistrationform">
    <?php
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'users-registration',
        //'action' => $this->createUrl('Users/userRegistration'),
        'enableAjaxValidation' => true,
    ));
    ?>


    <?php echo $form->errorSummary($model); ?>
    <div class="form-horizontal" role="form">

        <div class="notice">
            Fields with <span class="redit">*</span> are required 

        </div>
        <div class="form-group">
            <label for="inputEmail" class="col-sm-4">USERNAME/ EMAILID<span class="redit">*</span>:</label>
            <div class="col-sm-8">
                <?php echo $form->textField($model, 'username', array('maxlength' => 50, 'class' => 'form-control txtinput')); ?>
                <?php echo $form->error($model, 'username'); ?>
            </div>
        </div>
        <div class="form-group">
            <label for="inputPassword" class="col-sm-4">Password<span class="redit">*</span>:</label>
            <div class="col-sm-8">
                <?php echo $form->passwordField($model, 'password', array('maxlength' => 50, 'class' => 'form-control txtinput')); ?>
                <?php echo $form->error($model, 'password'); ?>
            </div>
        </div>

        <div class="form-group">
            <label for="confirm" class="col-sm-4">confirm  Password<span class="redit">*</span>:</label>
            <div class="col-sm-8">
                <?php echo $form->passwordField($model, 'confirm_password', array('maxlength' => 50, 'class' => 'form-control txtinput')); ?>
                <?php echo $form->error($model, 'confirm_password'); ?>
            </div>
        </div>

        <div class="form-group">
            <div class="checkbox choice">
                <?php echo CHtml::CheckBox('Users[issubscribe]', false, array('value' => '1', 'autocomplete' => 'off')); ?><label for="Users_issubscribe"><?php echo Message::SUBSCRIVE_NEWS_LETTER; ?></label>
            </div>

        </div>
        <div class="click">
            <?php
            echo CHtml::ajaxSubmitButton('Signup', Yii::app()->createUrl('/Users/userRegistration'), array(
                'dataType' => 'json',
                'type' => 'post',
                'success' => 'function(data) {
                         $("#registrationLoder").hide();  
                          if(data.authenticated==1) {
                                        window.location = data.redirectUrl;
                                    }
                        if(data.status=="success"){
                         $("#usersregistrationform").hide();
                          $("#registrationfromsuccess").show();
                         $("#registrationfromsuccess").html("Thank you for your registration. Please check your email or login.");
                                                }
                         else{
                        $.each(data, function(key, val) {
                        $("#users-registration #"+key+"_em_").text(val);                                                    
                        $("#users-registration #"+key+"_em_").show();
                        });
                        }       
                    }',
                'beforeSend' => 'function(){                        
                           $("#registrationLoder").show();
                      }'
                    ), array('id' => 'users-registrationbtn', 'class' => 'signup-n'));
            ?>
            <span id="registrationLoder" style="display: none"><img src="<?php echo ThemePath(); ?>/images/myskill.gif"></img></span>
        </div></div>
    <?php
    $this->endWidget();
    ?>

</div>

